package io.renren.modules.task.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.task.entity.MtCcEquipmentPointRelatEntity;
import io.renren.modules.task.service.MtCcEquipmentPointRelatService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-04-30 14:42:46
 */
@RestController
@RequestMapping("generator/mtccequipmentpointrelat")
public class MtCcEquipmentPointRelatController {
    @Autowired
    private MtCcEquipmentPointRelatService mtCcEquipmentPointRelatService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:mtccequipmentpointrelat:list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = mtCcEquipmentPointRelatService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:mtccequipmentpointrelat:info")
    public R info(@PathVariable("id") Long id) {
        MtCcEquipmentPointRelatEntity mtCcEquipmentPointRelat = mtCcEquipmentPointRelatService.getById(id);

        return R.ok().put("mtCcEquipmentPointRelat", mtCcEquipmentPointRelat);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:mtccequipmentpointrelat:save")
    public R save(@RequestBody MtCcEquipmentPointRelatEntity mtCcEquipmentPointRelat) {
        mtCcEquipmentPointRelatService.save(mtCcEquipmentPointRelat);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:mtccequipmentpointrelat:update")
    public R update(@RequestBody MtCcEquipmentPointRelatEntity mtCcEquipmentPointRelat) {
        mtCcEquipmentPointRelatService.updateById(mtCcEquipmentPointRelat);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:mtccequipmentpointrelat:delete")
    public R delete(@RequestBody Long[] ids) {
        mtCcEquipmentPointRelatService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
